Developer Documentation

QuickTime 4 API Documentation

3D Graphics Programming with QuickDraw 3D 1.5.4

Previous | QD3D Book | Overview | Chapter Contents | Next |

Private Draw Context Methods

To write a drawing engine, you need to implement several private methods for managing draw contexts.

Pointers to your drawing engine's private draw context methods are returned to QuickDraw 3D RAVE by your TQAEngineGetMethod method. See page  [link] for details.

TQADrawPrivateNew

A drawing engine must define a method to create its own private data and initialize a new draw context.

typedef TQAError (*TQADrawPrivateNew) (
                     TQADrawContext *newDrawContext,
                     const TQADevice *device,
                     const TQARect *rect,
                     const TQAClip *clip,
                     unsigned long flags);
newDrawContext
The draw context to initialize. On entry, all the fields of this structure have the value NULL .
device
A device.
rect
The rectangular region (specified in device coordinates) of the specified device that can be drawn into by the drawing engine associated with the new draw context.
clip
The two-dimensional clipping region for the new draw context, or NULL if no clipping is desired. This parameter must be set to NULL for devices of type kQADeviceMemory .
flags
A set of bit flags specifying features of the new draw context. See "Draw Context Flags Masks" for complete information.

DESCRIPTION

Your TQADrawPrivateNew function is called whenever an application calls QADrawContextNew to create a new draw context associated with your drawing engine. Your function should perform any initialization required for the new draw context. In particular, it should return a pointer to the draw context's private data in the drawPrivate field of the draw context structure pointed to by the newDrawContext parameter. In addition, your TQADrawPrivateNew function should set any other fields of that draw context structure to point to public draw context methods defined by the drawing engine.

Because it is the responsibility of your TQADrawPrivateNew function to initialize the fields of a draw context structure, you can load different methods depending on the features of the device or draw context specified by the device and flags parameters. For instance, you might load one line drawing function for a device that displays 16 bits per pixel and a different line drawing function for a device that displays 32 bits per pixel. This technique allows you to avoid testing the display depth each time you draw a line.

SEE ALSO

See Listing 11 for a sample TQADrawPrivateNew function.

TQADrawPrivateDelete

A drawing engine must define a method to delete its private data.

typedef void (*TQADrawPrivateDelete) (TQADrawPrivate *drawPrivate);
drawPrivate
The draw context's private data.

DESCRIPTION

Your TQADrawPrivateDelete function is called whenever an application calls QADrawContextDelete . Your function should release any memory or other resources that were allocated by your TQADrawPrivateNew function.

TQAEngineCheckDevice

A drawing engine must define a method to indicate whether the engine can draw to a particular device.

typedef TQAError (*TQAEngineCheckDevice) (const TQADevice *device);
device
A device.

DESCRIPTION

Your TQAEngineCheckDevice function should return, as its function result, a code that indicates whether your drawing engine can draw into the device specified by the device parameter ( kQANoErr ) or not ( kQAError ).

TQAEngineGestalt

A drawing engine must define a method to return information about its capabilities.

typedef TQAError (*TQAEngineGestalt) (
                     TQAGestaltSelector selector,
                     void *response);
selector
A selector that determines what kind of information is to be returned about your drawing engine. See "Gestalt Selectors" for complete information about the available selectors and the information you should return.
response
A pointer to a buffer into which the returned information is to be copied. The calling application is responsible for allocating this buffer. The size and meaning of the data to be copied depends on the selector passed in the selector parameter.

DESCRIPTION

Your TQAEngineGestalt function is called whenever an application calls QAEngineGestalt . Your function should return, in the buffer pointed to by the response parameter, information about features of the type specified by the selector parameter.


© 1997 Apple Computer, Inc.

Previous | QD3D Book | Overview | Chapter Contents | Next |